package com.android.widget;

import android.graphics.Color;

import org.w3c.dom.Node;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Relin
 * on 2018-11-23.
 * 思维导图节点
 */
public class ThinkNode {

    /**
     * 节点ID
     */
    private String id;
    /**
     * 几点级数
     */
    private int level;
    /**
     * 绘制坐标X
     */
    private float x;
    /**
     * 绘制坐标Y
     */
    private float y;
    /**
     * 节点左上方X
     */
    private float ltX;
    /**
     * 节点左上方Y
     */
    private float ltY;
    /**
     * 节点右下方X
     */
    private float rbX;
    /**
     * 节点右下方Y
     */
    private float rbY;
    /**
     * 节点原件大小
     */
    private float radius = 8;
    /**
     * 节点文字
     */
    private String text;
    /**
     * 文字大小哦
     */
    private float textSize = 30;
    /**
     * 文字颜色
     */
    private int textColor = Color.WHITE;
    /**
     * 背景颜色
     */
    private int background = Color.parseColor("#29CA61");
    /**
     * 是否选中
     */
    private boolean isSelected = false;
    /**
     * 内部间距
     */
    private float padding = 20;
    /**
     * 最大宽度
     */
    private float maxWidth = 200;
    /**
     * 节点宽度
     */
    private float width;
    /**
     * 节点高度
     */
    private float height;
    /**
     * 子节点
     */
    private List<ThinkNode> children;
    /**
     * 父节点
     */
    private ThinkNode parent;
    /**
     * 是否是水平方向
     */
    private boolean isHorizontal;
    /**
     * 节点位置
     */
    private int position;
    /**
     * 是否是源节点
     */
    private boolean isOrigin;
    /**
     * 和父子点同水平线坐标Y
     */
    private float horizontalY;
    /**
     * 一级节点
     */
    private ThinkNode firstLevelNode;
    /**
     * 相对一级节点 - 最后一个底部节点
     */
    private ThinkNode relativeFirstLevelBelowNode;
    /**
     * 相对一级节点 - 最上一个节点
     */
    private ThinkNode  relativeFirstLevelTopNode;

    private float textWith;

    private float textHeight;

    private float offsetTop = 0;

    private float offsetBelow = 0;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getLevel() {
        return level;
    }

    public void setLevel(int level) {
        this.level = level;
    }

    public float getMaxWidth() {
        return maxWidth;
    }

    public void setMaxWidth(float maxWidth) {
        this.maxWidth = maxWidth;
    }

    public float getX() {
        return x;
    }

    public void setX(float x) {
        this.x = x;
    }

    public float getY() {
        return y;
    }

    public void setY(float y) {
        this.y = y;
    }

    public float getLtX() {
        return ltX;
    }

    public void setLtX(float ltX) {
        this.ltX = ltX;
    }

    public float getLtY() {
        return ltY;
    }

    public void setLtY(float ltY) {
        this.ltY = ltY;
    }

    public float getRbX() {
        return rbX;
    }

    public void setRbX(float rbX) {
        this.rbX = rbX;
    }

    public float getRbY() {
        return rbY;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public void setRbY(float rbY) {
        this.rbY = rbY;
    }

    public float getRadius() {
        return radius;
    }

    public void setRadius(float radius) {
        this.radius = radius;
    }

    public float getTextSize() {
        return textSize;
    }

    public void setTextSize(float textSize) {
        this.textSize = textSize;
    }

    public int getTextColor() {
        return textColor;
    }

    public void setTextColor(int textColor) {
        this.textColor = textColor;
    }

    public int getBackground() {
        return background;
    }

    public void setBackground(int background) {
        this.background = background;
    }

    public boolean isSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }

    public float getPadding() {
        return padding;
    }

    public void setPadding(float padding) {
        this.padding = padding;
    }

    public float getWidth() {
        return width;
    }

    public void setWidth(float width) {
        this.width = width;
    }

    public float getHeight() {
        return height;
    }

    public void setHeight(float height) {
        this.height = height;
    }

    public List<ThinkNode> getChildren() {
        if (children == null) {
            children = new ArrayList<>();
        }
        return children;
    }

    public void setChildren(List<ThinkNode> child) {
        this.children = children;
    }

    public ThinkNode getParent() {
        return parent;
    }

    public void setParent(ThinkNode parent) {
        this.parent = parent;
    }

    public boolean isHorizontal() {
        return isHorizontal;
    }

    public void setHorizontal(boolean horizontal) {
        isHorizontal = horizontal;
    }

    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public boolean isOrigin() {
        return isOrigin;
    }

    public void setOrigin(boolean origin) {
        isOrigin = origin;
    }

    public float getHorizontalY() {
        return horizontalY;
    }

    public void setHorizontalY(float horizontalY) {
        this.horizontalY = horizontalY;
    }

    public ThinkNode getFirstLevelNode() {
        return firstLevelNode;
    }

    public void setFirstLevelNode(ThinkNode firstLevelNode) {
        this.firstLevelNode = firstLevelNode;
    }

    public float getOffsetTop() {
        return offsetTop;
    }

    public void setOffsetTop(float offsetTop) {
        this.offsetTop = offsetTop;
    }

    public float getOffsetBelow() {
        return offsetBelow;
    }

    public void setOffsetBelow(float offsetBelow) {
        this.offsetBelow = offsetBelow;
    }

    public float getTextWith() {
        return textWith;
    }

    public void setTextWith(float textWith) {
        this.textWith = textWith;
    }

    public float getTextHeight() {
        return textHeight;
    }

    public void setTextHeight(float textHeight) {
        this.textHeight = textHeight;
    }

    public ThinkNode getRelativeFirstLevelBelowNode() {
        return relativeFirstLevelBelowNode;
    }

    public void setRelativeFirstLevelBelowNode(ThinkNode relativeFirstLevelBelowNode) {
        this.relativeFirstLevelBelowNode = relativeFirstLevelBelowNode;
    }

    public ThinkNode getRelativeFirstLevelTopNode() {
        return relativeFirstLevelTopNode;
    }

    public void setRelativeFirstLevelTopNode(ThinkNode relativeFirstLevelTopNode) {
        this.relativeFirstLevelTopNode = relativeFirstLevelTopNode;
    }
}
